package com.nbsaas.boot.pms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "项目", model = "项目")
@Entity
@Table(name = "bs_pms_project")
@Comment("项目表")
public class Project extends AbstractEntity {

    @Comment("项目名称")
    @SearchItem(name = "name", key = "name", label = "项目名称")
    @FormField(title = "项目名称", sortNum = "1", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("项目编码")
    @SearchItem(name = "code", key = "code", label = "项目编码")
    @FormField(title = "项目编码", sortNum = "2", grid = true)
    @Column(length = 50, unique = true)
    private String code;

    @Comment("项目描述")
    @FormField(title = "项目描述", sortNum = "3", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "TEXT")
    private String description;

    @Comment("项目状态")
    @FormField(title = "项目状态", sortNum = "4", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // PLANNING-规划中, IN_PROGRESS-进行中, ON_HOLD-暂停, COMPLETED-已完成, CANCELLED-已取消

    @Comment("项目优先级")
    @FormField(title = "项目优先级", sortNum = "5", grid = true, type = InputType.select)
    @Column(length = 20)
    private String priority; // LOW-低, MEDIUM-中, HIGH-高, URGENT-紧急

    @Comment("项目类型")
    @FormField(title = "项目类型", sortNum = "6", grid = true, type = InputType.select)
    @Column(length = 20)
    private String type; // DEVELOPMENT-开发项目, MAINTENANCE-维护项目, RESEARCH-研究项目, OTHER-其他

    @Comment("项目经理ID")
    @FormField(title = "项目经理", sortNum = "7", grid = true, type = InputType.select)
    private Long managerId;

    @Comment("客户ID")
    @FormField(title = "客户", sortNum = "8", grid = true, type = InputType.select)
    private Long customerId;

    @Comment("预算金额")
    @FormField(title = "预算金额", sortNum = "9", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 15, scale = 2)
    private BigDecimal budget;

    @Comment("实际成本")
    @FormField(title = "实际成本", sortNum = "10", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 15, scale = 2)
    private BigDecimal actualCost;

    @Comment("计划开始时间")
    @FormField(title = "计划开始时间", sortNum = "11", type = InputType.date, grid = true)
    private Date plannedStartDate;

    @Comment("计划结束时间")
    @FormField(title = "计划结束时间", sortNum = "12", type = InputType.date, grid = true)
    private Date plannedEndDate;

    @Comment("实际开始时间")
    @FormField(title = "实际开始时间", sortNum = "13", type = InputType.date, grid = true)
    private Date actualStartDate;

    @Comment("实际结束时间")
    @FormField(title = "实际结束时间", sortNum = "14", type = InputType.date, grid = true)
    private Date actualEndDate;

    @Comment("完成百分比")
    @FormField(title = "完成百分比", sortNum = "15", grid = true, type = InputType.el_input_number, sort = true)
    private Integer progress; // 0-100

    @Comment("项目标签")
    @FormField(title = "项目标签", sortNum = "16")
    @Column(length = 500)
    private String tags;

    @Comment("项目文档")
    @FormField(title = "项目文档", sortNum = "17", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String documents;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "18", type = InputType.textarea, col = 23)
    @Column(columnDefinition = "TEXT")
    private String remarks;
} 